package com.example.demo.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

/**
 * Created by hongzhenyue on 18/2/27.
 */
public class DemoUtils {
    private static final Logger logger = LoggerFactory.getLogger(DemoUtils.class);

    public static void createPdf(String url,String pdf){
        InputStream inputStream = null;
        try {
            inputStream = new URL(url).openStream();
            FlySaucerUtil.createPdf(inputStream,pdf);
        } catch (Exception e) {
            logger.info(e.getMessage(),e);
        }finally {
            if(inputStream != null)
                try {
                    inputStream.close();
                } catch (IOException e) {
                    logger.error(e.getMessage(),e);
                }
        }
    }
}
